package cn.yunhe.services;


import cn.yunhe.dao.IFoodDaoMapper;
import cn.yunhe.entity.merchantsentity.Food;
import cn.yunhe.util.SqlSessionFactoryUtil;
import net.sf.json.JSONArray;
import org.apache.ibatis.session.SqlSession;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * 周依博
 * 遍历全部菜品信息，根据商家ID
 */
public class ShowFoodService {
    SqlSession session = SqlSessionFactoryUtil.getSqlSession();
    IFoodDaoMapper foodDaoMapper = session.getMapper(IFoodDaoMapper.class);
    public JSONArray getAllFoodList(int mid){
        JSONArray jsonArray = new JSONArray();
        List<Food> foodList = foodDaoMapper.getAllFoodList(mid);
        jsonArray.addAll(foodList);
        return jsonArray;
    }

}
